package com.example.administrator.foodrowfresh.configs.classifyconfing.classifyentity;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by lqr on 2016/5/3.
 */
public class MyClassifyDetailEntity {

    /**
     * success : 1
     * data : {"last_page_num":2,"list":[{"unitprice":2.38,"id":73,"name":"红苋菜","price":2.98,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":73,"pvweight":400,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_1_jpeg_290.jpeg"},{"unitprice":3.56,"id":2900,"name":"甘蓝包菜","price":1.98,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":2895,"pvweight":900,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_8706_jpeg_290.jpeg"},{"unitprice":1.32,"id":270,"name":"牛心菜","price":1.2,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":270,"pvweight":550,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_109_jpeg_290.jpeg"},{"unitprice":2.24,"id":1,"name":"菠菜","price":3.2,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":1,"pvweight":350,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_15571_jpeg_290.jpeg"},{"unitprice":5.4,"id":72,"name":"大白菜","price":1.5,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":72,"pvweight":1800,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_14857_jpeg_290.jpeg"},{"unitprice":1.08,"id":2,"name":"生菜","price":1.2,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":2,"pvweight":450,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_1004_jpeg_290.jpeg"},{"unitprice":5.25,"id":138,"name":"娃娃菜","price":3.5,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":138,"pvweight":750,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_11686_jpeg_290.jpeg"},{"unitprice":3.04,"id":1196,"name":"球生菜","price":3.8,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":1196,"pvweight":400,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_2072_jpeg_290.jpeg"},{"unitprice":1.05,"id":57,"name":"地产鸡毛菜","price":1.5,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":57,"pvweight":350,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_19400_jpeg_290.jpeg"},{"unitprice":3.15,"id":5,"name":"空心菜","price":3.5,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":5,"pvweight":450,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_18849_jpeg_290.jpeg"},{"unitprice":1.61,"id":69,"name":"韭菜","price":2.3,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":69,"pvweight":350,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_1290_jpeg_290.jpeg"},{"unitprice":8.5,"id":363,"name":"袋装太湖莼菜","price":8.5,"weight":"袋","sold_out":0,"status":0,"standard":true,"unitstandard":"350g/袋(连水)","pvid":363,"pvweight":0,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_309_jpeg_290.jpeg"},{"unitprice":2.5,"id":310,"name":"广东菜心","price":2.5,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":310,"pvweight":500,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_357_jpeg_290.jpeg"},{"unitprice":2.24,"id":357,"name":"芥兰","price":2.8,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":357,"pvweight":400,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_11588_jpeg_290.jpeg"},{"unitprice":2.32,"id":67,"name":"茼蒿","price":2.9,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":67,"pvweight":400,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_61_jpeg_290.jpeg"},{"unitprice":4.99,"id":4657,"name":"非洲冰草","price":7.8,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":4615,"pvweight":320,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_18831_jpeg_290.jpeg"},{"unitprice":3.57,"id":4313,"name":"娃娃菜（大）","price":2.98,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":4271,"pvweight":600,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_15952_jpeg_290.jpeg"},{"unitprice":3.3,"id":3860,"name":"豌豆苗","price":5.5,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":3818,"pvweight":300,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_18410_jpeg_290.jpeg"},{"unitprice":7.8,"id":3858,"name":"紫包菜约1000g","price":3.9,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":3816,"pvweight":1000,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_13783_jpeg_290.jpeg"},{"unitprice":2.2,"id":3475,"name":"苦菊（新）","price":5.5,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":3434,"pvweight":200,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_11331_jpeg_290.jpeg"}]}
     */

    private int success;
    /**
     * last_page_num : 2
     * list : [{"unitprice":2.38,"id":73,"name":"红苋菜","price":2.98,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":73,"pvweight":400,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_1_jpeg_290.jpeg"},{"unitprice":3.56,"id":2900,"name":"甘蓝包菜","price":1.98,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":2895,"pvweight":900,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_8706_jpeg_290.jpeg"},{"unitprice":1.32,"id":270,"name":"牛心菜","price":1.2,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":270,"pvweight":550,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_109_jpeg_290.jpeg"},{"unitprice":2.24,"id":1,"name":"菠菜","price":3.2,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":1,"pvweight":350,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_15571_jpeg_290.jpeg"},{"unitprice":5.4,"id":72,"name":"大白菜","price":1.5,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":72,"pvweight":1800,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_14857_jpeg_290.jpeg"},{"unitprice":1.08,"id":2,"name":"生菜","price":1.2,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":2,"pvweight":450,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_1004_jpeg_290.jpeg"},{"unitprice":5.25,"id":138,"name":"娃娃菜","price":3.5,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":138,"pvweight":750,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_11686_jpeg_290.jpeg"},{"unitprice":3.04,"id":1196,"name":"球生菜","price":3.8,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":1196,"pvweight":400,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_2072_jpeg_290.jpeg"},{"unitprice":1.05,"id":57,"name":"地产鸡毛菜","price":1.5,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":57,"pvweight":350,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_19400_jpeg_290.jpeg"},{"unitprice":3.15,"id":5,"name":"空心菜","price":3.5,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":5,"pvweight":450,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_18849_jpeg_290.jpeg"},{"unitprice":1.61,"id":69,"name":"韭菜","price":2.3,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":69,"pvweight":350,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_1290_jpeg_290.jpeg"},{"unitprice":8.5,"id":363,"name":"袋装太湖莼菜","price":8.5,"weight":"袋","sold_out":0,"status":0,"standard":true,"unitstandard":"350g/袋(连水)","pvid":363,"pvweight":0,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_309_jpeg_290.jpeg"},{"unitprice":2.5,"id":310,"name":"广东菜心","price":2.5,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":310,"pvweight":500,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_357_jpeg_290.jpeg"},{"unitprice":2.24,"id":357,"name":"芥兰","price":2.8,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":357,"pvweight":400,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_11588_jpeg_290.jpeg"},{"unitprice":2.32,"id":67,"name":"茼蒿","price":2.9,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":67,"pvweight":400,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_61_jpeg_290.jpeg"},{"unitprice":4.99,"id":4657,"name":"非洲冰草","price":7.8,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":4615,"pvweight":320,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_18831_jpeg_290.jpeg"},{"unitprice":3.57,"id":4313,"name":"娃娃菜（大）","price":2.98,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":4271,"pvweight":600,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_15952_jpeg_290.jpeg"},{"unitprice":3.3,"id":3860,"name":"豌豆苗","price":5.5,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":3818,"pvweight":300,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_18410_jpeg_290.jpeg"},{"unitprice":7.8,"id":3858,"name":"紫包菜约1000g","price":3.9,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":3816,"pvweight":1000,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_13783_jpeg_290.jpeg"},{"unitprice":2.2,"id":3475,"name":"苦菊（新）","price":5.5,"weight":"500g","sold_out":0,"status":0,"standard":false,"unitstandard":"500g","pvid":3434,"pvweight":200,"image":"http://images4sh-app.34580.com/images/ProductImages/SH_Image_11331_jpeg_290.jpeg"}]
     */

    private DataBean data;

    public static MyClassifyDetailEntity objectFromData(String str) {

        return new Gson().fromJson(str, MyClassifyDetailEntity.class);
    }

    public static MyClassifyDetailEntity objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), MyClassifyDetailEntity.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public static List<MyClassifyDetailEntity> arrayMyClassifyDetailEntityFromData(String str) {

        Type listType = new TypeToken<ArrayList<MyClassifyDetailEntity>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public static List<MyClassifyDetailEntity> arrayMyClassifyDetailEntityFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);
            Type listType = new TypeToken<ArrayList<MyClassifyDetailEntity>>() {
            }.getType();

            return new Gson().fromJson(jsonObject.getString(str), listType);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return new ArrayList();


    }

    public int getSuccess() {
        return success;
    }

    public void setSuccess(int success) {
        this.success = success;
    }

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public static class DataBean {
        private int last_page_num;
        /**
         * unitprice : 2.38
         * id : 73
         * name : 红苋菜
         * price : 2.98
         * weight : 500g
         * sold_out : 0
         * status : 0
         * standard : false
         * unitstandard : 500g
         * pvid : 73
         * pvweight : 400.0
         * image : http://images4sh-app.34580.com/images/ProductImages/SH_Image_1_jpeg_290.jpeg
         */

        private List<ListBean> list;

        public static DataBean objectFromData(String str) {

            return new Gson().fromJson(str, DataBean.class);
        }

        public static DataBean objectFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);

                return new Gson().fromJson(jsonObject.getString(str), DataBean.class);
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        public static List<DataBean> arrayDataBeanFromData(String str) {

            Type listType = new TypeToken<ArrayList<DataBean>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public static List<DataBean> arrayDataBeanFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);
                Type listType = new TypeToken<ArrayList<DataBean>>() {
                }.getType();

                return new Gson().fromJson(jsonObject.getString(str), listType);

            } catch (JSONException e) {
                e.printStackTrace();
            }

            return new ArrayList();


        }

        public int getLast_page_num() {
            return last_page_num;
        }

        public void setLast_page_num(int last_page_num) {
            this.last_page_num = last_page_num;
        }

        public List<ListBean> getList() {
            return list;
        }

        public void setList(List<ListBean> list) {
            this.list = list;
        }

        public static class ListBean {
            private double unitprice;
            private int id;
            private String name;
            private double price;
            private String weight;
            private int sold_out;
            private int status;
            private boolean standard;
            private String unitstandard;
            private int pvid;
            private double pvweight;
            private String image;

            public static ListBean objectFromData(String str) {

                return new Gson().fromJson(str, ListBean.class);
            }

            public static ListBean objectFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);

                    return new Gson().fromJson(jsonObject.getString(str), ListBean.class);
                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return null;
            }

            public static List<ListBean> arrayListBeanFromData(String str) {

                Type listType = new TypeToken<ArrayList<ListBean>>() {
                }.getType();

                return new Gson().fromJson(str, listType);
            }

            public static List<ListBean> arrayListBeanFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);
                    Type listType = new TypeToken<ArrayList<ListBean>>() {
                    }.getType();

                    return new Gson().fromJson(jsonObject.getString(str), listType);

                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return new ArrayList();


            }

            public double getUnitprice() {
                return unitprice;
            }

            public void setUnitprice(double unitprice) {
                this.unitprice = unitprice;
            }

            public int getId() {
                return id;
            }

            public void setId(int id) {
                this.id = id;
            }

            public String getName() {
                return name;
            }

            public void setName(String name) {
                this.name = name;
            }

            public double getPrice() {
                return price;
            }

            public void setPrice(double price) {
                this.price = price;
            }

            public String getWeight() {
                return weight;
            }

            public void setWeight(String weight) {
                this.weight = weight;
            }

            public int getSold_out() {
                return sold_out;
            }

            public void setSold_out(int sold_out) {
                this.sold_out = sold_out;
            }

            public int getStatus() {
                return status;
            }

            public void setStatus(int status) {
                this.status = status;
            }

            public boolean isStandard() {
                return standard;
            }

            public void setStandard(boolean standard) {
                this.standard = standard;
            }

            public String getUnitstandard() {
                return unitstandard;
            }

            public void setUnitstandard(String unitstandard) {
                this.unitstandard = unitstandard;
            }

            public int getPvid() {
                return pvid;
            }

            public void setPvid(int pvid) {
                this.pvid = pvid;
            }

            public double getPvweight() {
                return pvweight;
            }

            public void setPvweight(double pvweight) {
                this.pvweight = pvweight;
            }

            public String getImage() {
                return image;
            }

            public void setImage(String image) {
                this.image = image;
            }
        }
    }
}
